package StringStudy;

@SuppressWarnings("all")
public class StringLearn1 {
    public static void main(String[] args) {
        /**
         * String  不可变字符序列  final char []
         *
         */
        //jvm  (栈 ，堆，方法区，常量池)
        String str = "abcde";
        String str1 = "abcde";
        System.out.println("str==str1 = " + (str == str1));
        System.out.println("str1.length() = " + str1.length());



        String str2 = new String("xyz");
        String str3 = new String("xyz");
        System.out.println("str2 = " + str2);
        System.out.println("str3 = " + str3);
        System.out.println("str2==str3 = " + (str2 == str3));
        System.out.println("str2.equals(str3) = " + str2.equals(str3));

/**
 * 可变字符序列
 */
        StringBuilder str4 = new StringBuilder("xyz");//线程不安全

        StringBuffer str5 = new StringBuffer("xyz");//线程安全
        str5.append("abcd").append("xyz").append("wwww");
        System.out.println("str5 = " + str5);

//对象  属性和方法 int-->Integer
    }
}
